<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/9/29
 * Time: 20:49
 */

include_once 'redis.php';

$prevData = $redis->hGetALL($_GET['key'] ?? '');// 获取上次填写的内容
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>注册</title>
</head>
<body>
<form action="register.php" method="post">
    <table border="1">
        <tr>
            <th colspan="2">欢迎注册</th>
        </tr>
        <tr>
            <td>账号</td>
            <td><input id="username" name="username" type="text" value="<?php echo @$prevData['username'] ?>"
                       placeholder="账号"/></td>
        </tr>
        <tr>
            <td>密码</td>
            <td><input id="password" name="password" type="password" value="<?php echo @$prevData['password'] ?>"
                       placeholder="密码"/></td>
        </tr>
        <tr>
            <td>姓名</td>
            <td><input id="name" name="name" type="text" value="<?php echo @$prevData['name'] ?>" placeholder="姓名"/>
            </td>
        </tr>
        <tr>
            <td>电话</td>
            <td><input id="phone" name="phone" type="text" value="<?php echo @$prevData['phone'] ?>" placeholder="电话"/>
            </td>
        </tr>
        <tr>
            <td>年龄</td>
            <td><input id="age" name="age" type="number" value="<?php echo @$prevData['age'] ?>" placeholder="年龄"/></td>
        </tr>
        <tr>
            <td colspan="2" align="center">
                <button type="submit">注册</button>
                <button type="button" onclick='window.location.href="login.php"'>已有账号？点击登录</button>
            </td>
        </tr>
    </table>
</form>
</body>
</html>
